package com.kgcx.common.config;

import com.kgcx.common.handler.CustSpringDecoder;
import feign.codec.Decoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.ResponseEntityDecoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 吴刚林
 * @date 2018/4/4
 */
@Configuration
public class FeignConifg {
    @Autowired
    private ObjectFactory<HttpMessageConverters> messageConverters;

    @Bean
    public Decoder feignDecoder() {
        return new ResponseEntityDecoder(new CustSpringDecoder(this.messageConverters));
    }

//    @Bean
//    public Request.Options options() {
//        return new Request.Options();
//    }
}
